import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
const routes = [
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login"),
  },
  {
    path: "",
    name: "layout",
    component: () => import("@/views/layout"),
    children: [
      {
        path: "/", //二级路由必须写入  /
        name: "home",
        component: () => import("@/views/home"),
      },
      {
        path: "/qa",
        name: "qa",
        component: () => import("@/views/qa"),
      },
      {
        path: "/video",
        name: "video",
        component: () => import("@/views/video"),
      },
      {
        path: "/my",
        name: "my",
        component: () => import("@/views/my"),
      },
    ],
  },
  {
    path:"/search",
    name:"search",
    component:()=>import("@/views/search")
  },
  {
    path:"/article/:articleId",
    name:"article",
    component:()=>import("@/views/article"),
    props:true//开启路由传参 就是 把这个参数传入到这个article这个组价中;
  },
  {
    path:"/user/profile",
    name:"user-profile",
    component:()=>import("@/views/user-profile"),
  }
];

export default new VueRouter({
  routes,
});
